VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "DAOTipo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private mvarConnection As utilConexion 'local copy

Public Sub setConnection(ByVal vdata As utilConexion)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Connection = Form1
    Set mvarConnection = vdata
End Sub


Public Function getLista(tabla As String) As Collection
Dim sql As String
Dim rst As New Recordset
Dim list As New Collection
Dim record As New bTipo

sql = "SELECT ncodigo, sdescripcion FROM tipo where sTabla= '" + tabla + "'"
rst.Open sql, mvarConnection.Connection, adOpenForwardOnly

While Not rst.EOF
    Set record = New bTipo
    If Not IsNull(rst.Fields("ncodigo")) Then record.nCodigo = rst.Fields("ncodigo").value
    If Not IsNull(rst.Fields("sdescripcion")) Then record.sDescripcion = rst.Fields("sdescripcion").value
    rst.MoveNext
    list.Add record
Wend
Set getLista = list
End Function

